package Practice04.test4;

public class Filename {
    private String fullPath;  //全路径名
    private char pathSeparator;  //路径符
    private char extensionSeparator;  //扩展名符
    public Filename(String str, char sep, char ext) {
        fullPath = str;
        pathSeparator = sep;
        extensionSeparator = ext;
    }
    public String extension() {    //取得扩展名
        return fullPath.substring(fullPath.lastIndexOf(".")+1);
    }
    public String filename() { //取得文件名
        return fullPath.substring(fullPath.lastIndexOf("/")+1,fullPath.lastIndexOf("."));
    }
    public String path() { //取得路径
        return fullPath.substring(fullPath.lastIndexOf("/"));
    }
}
